<?php


declare (strict_types=1);

namespace app\controller;

use app\BaseController;
use app\job\Task;
use app\model\Banner;
use app\model\GoodsOrders;
use app\model\Notice;
use app\service\UserService;
use app\tool\Date;
use DateInterval;
use DatePeriod;
use DateTime;
use Faker\Factory;
use think\facade\Queue;

class IndexController extends BaseController
{
	
	
	
	function index()
	{
		$orders = GoodsOrders::where(['order_no' => '2024022265D6B083C0167', 'status' => 0])->find();
		if (!$orders) {
			$this->writeJson(0, '订单不存在');
		}
		$orders->status = 1;
		$orders->goods->sales += 1;
		$orders->paytime = time();
		$orders->together(['goods'])->save();
		$this->writeJson();
	}
	/**
	 * 获取轮播图
	 * @return void
	 */
	function getBanner()
	{
		$rows = Banner::whereBetweenTimeField('starttime', 'endtime')->order(['weigh' => 'desc'])->select();
		$this->writeJson($rows);
	}
	
	/**
	 * 获取公告栏
	 * @return void
	 */
	function getNotice()
	{
		$rows = Notice::whereBetweenTimeField('starttime', 'endtime')->order(['weigh' => 'desc'])->select();
		$this->writeJson($rows);
	}
	

	

	
	
	
	
}
